/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.swt.mto.thithu.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import com.swt.mto.thithu.model.Result;

import java.io.Serializable;

/**
 * The cache model class for representing Result in entity cache.
 *
 * @author tuan.nguyen
 * @see Result
 * @generated
 */
public class ResultCacheModel implements CacheModel<Result>, Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(17);

		sb.append("{resultId=");
		sb.append(resultId);
		sb.append(", quizId=");
		sb.append(quizId);
		sb.append(", userId=");
		sb.append(userId);
		sb.append(", questionId=");
		sb.append(questionId);
		sb.append(", userName=");
		sb.append(userName);
		sb.append(", userChoice=");
		sb.append(userChoice);
		sb.append(", correct=");
		sb.append(correct);
		sb.append(", score=");
		sb.append(score);
		sb.append("}");

		return sb.toString();
	}

	public Result toEntityModel() {
		ResultImpl resultImpl = new ResultImpl();

		resultImpl.setResultId(resultId);
		resultImpl.setQuizId(quizId);
		resultImpl.setUserId(userId);
		resultImpl.setQuestionId(questionId);

		if (userName == null) {
			resultImpl.setUserName(StringPool.BLANK);
		}
		else {
			resultImpl.setUserName(userName);
		}

		if (userChoice == null) {
			resultImpl.setUserChoice(StringPool.BLANK);
		}
		else {
			resultImpl.setUserChoice(userChoice);
		}

		if (correct == null) {
			resultImpl.setCorrect(StringPool.BLANK);
		}
		else {
			resultImpl.setCorrect(correct);
		}

		resultImpl.setScore(score);

		resultImpl.resetOriginalValues();

		return resultImpl;
	}

	public long resultId;
	public long quizId;
	public long userId;
	public long questionId;
	public String userName;
	public String userChoice;
	public String correct;
	public int score;
}